<template>
<div id="app">
    <HeaderComponent />
    <main class="main-content">
        <router-view />
    </main>

    <!-- 移动端底部导航栏 -->
    <div class="mobile-bottom-nav">
        <router-link to="/" class="nav-item" active-class="active" exact>
            <i class="el-icon-s-home"></i>
            <span>首页</span>
        </router-link>
        <router-link to="/about" class="nav-item" active-class="active">
            <i class="el-icon-info"></i>
            <span>关于</span>
        </router-link>
        <router-link to="/contact" class="nav-item" active-class="active">
            <i class="el-icon-message"></i>
            <span>联系</span>
        </router-link>
        <router-link to="/submit" class="nav-item" active-class="active">
            <i class="el-icon-plus"></i>
            <span>提交</span>
        </router-link>
    </div>
</div>
</template>

<script>
import HeaderComponent from '@/components/Header.vue'

export default {
    name: 'App',
    components: {
        HeaderComponent
    }
}
</script>

<style>
body {
    margin: 0;
    padding: 0;
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    background-color: #f5f7fa;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding-top: 60px;
    /* 为固定header留出空间 */
    position: relative;
}

/* 全局样式重置，确保元素素之间的间距一致 */
h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin-top: 0;
}

/* 确保el-menu在各页面样式一致 */
.el-menu.el-menu--horizontal {
    border-bottom: none;
}

/* 移动端底部导航栏 */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background-color: #ffffff;
    z-index: 990;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #909399;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s;
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 2px;
}

.nav-item.active {
    color: #409EFF;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .main-content {
        padding-top: 60px;
        padding-bottom: 56px;
        /* 为底部导航留出空间 */
    }

    body {
        overflow-x: hidden;
        /* 防止在移动设备上出现水平滚动 */
    }

    /* 调整element-ui组件在移动端的表现 */
    .el-message {
        min-width: 80% !important;
        width: 80% !important;
    }

    /* 增强移动端触摸体验 */
    input,
    button,
    .el-button {
        -webkit-tap-highlight-color: transparent;
    }

    /* 移动端点击态反馈 */
    .el-button:active {
        transform: scale(0.98);
    }

    /* 显示移动端底部导航 */
    .mobile-bottom-nav {
        display: flex;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {

    /* 调整超小屏幕上的间距 */
    .el-row {
        margin-left: -5px !important;
        margin-right: -5px !important;
    }

    .el-col {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .nav-item {
        font-size: 11px;
    }

    .nav-item i {
        font-size: 20px;
    }
}
</style>
